﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Chaotic.Module.General.Views
{
    /// <summary>
    /// TelerikDialogWindow.xaml 的交互逻辑
    /// </summary>
    public partial class TelerikDialogWindow : IDialogWindow
    {
        public TelerikDialogWindow()
        {
            InitializeComponent();
            this.Closed += TelerikDialogWindow_Closed;
        }

        private void TelerikDialogWindow_Closed(object? sender, Telerik.Windows.Controls.WindowClosedEventArgs e)
        {
            Closing?.Invoke(this, new CancelEventArgs(false)); 
            _closed?.Invoke(this, new EventArgs());
        }

        public IDialogResult Result { get; set; }
        Window IDialogWindow.Owner { get; set; }

        public event CancelEventHandler Closing;

        private EventHandler _closed;
        event EventHandler IDialogWindow.Closed
        {
            add
            {
                _closed += value;
            }
            remove { _closed -= value; }
        }

 
        //// 显式实现接口事件，使用事件访问器语法
        //event EventHandler IDialogWindow.Closed
        //{
        //    add { Closed += value; }
        //    remove { Closed -= value; }
        //}
    }
}
